/*************************************************************************
	> File Name: Memento.h
	> Author: Joker
	> Mail: mahongtao@foxmail.com 
	> Created Time: 2020-09-23 00:40:11
 ************************************************************************/

#ifndef __MEMENTO_H__
#define __MEMENTO_H__

#include <string>

using std::string;

typedef string STATE;

class Memento;

class Originator
{
public:
    Originator();
    Originator(const STATE & State);
    ~Originator();

    Memento * CreateMemento();
    void SetMemento(Memento * pMemento);
    STATE GetState();
    void SetState(const STATE & State);
    void RestoreState(Memento * pMemento);
    void PrintState();

private:
    STATE _State;
};

class Memento
{
private:
    friend class Originator;
    Memento(const STATE & State);
    void SetState(const STATE & State);
    STATE GetState();

    STATE _State;
};


#endif
